﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml.Serialization;

namespace AliyunMobileTestPlatform.Models
{
    [Serializable]
    public class BranchModel
    {
        public string Name { set; get; }

        public string Revision { set; get; }

        public string Repository { set; get; }

        [XmlIgnoreAttribute]
        public string EncodedRepositoryString 
        {
            get 
            {
                return System.Web.HttpUtility.UrlEncode(Convert.ToBase64String(System.Text.Encoding.Default.GetBytes(Repository)));
            }
        }

        [XmlIgnoreAttribute]
        public string ID 
        {
            get 
            {
                return Name.Replace(' ', '_').Replace('.', '_');
            }
        }

        [XmlIgnoreAttribute]
        public TagsModel Tags { set; get; }
    }
}